home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1985-07-13 | 1.8 KB | 57 lines |
- 10 '
- 15 ' Name - DBase
- 20 '
- 25 ' Function - This program reads a DBase II file and lists the fields
- 30 ' on the screen. This is a simple program, but it documents
- 35 ' the format of the header record of the data base.
- 40 '
- 45 ' Author - Gerald F. Uhlig
- 50 '
- 55 CLS : CLOSE
- 60 DIM A$(5)
- 65 DIM C1$(32), C2$(32), C3(32), Z$(32)
- 70 INPUT "enter name of 'DBase' file "; F1$
- 75 F1$ = F1$ + ".dbf"
- 80 OPEN F1$ FOR INPUT AS 1
- 85 Q$ = INPUT$( 1,#1)
- 90 A$(1) = INPUT$( 2,#1) ' Number of records
- 95 A$(2) = INPUT$( 1,#1) ' Month - last update
- 100 A$(3) = INPUT$( 1,#1) ' Day - last update
- 105 A$(4) = INPUT$( 1,#1) ' Year - last update
- 110 A$(5) = INPUT$( 2,#1) ' Length of record
- 115 A1 = (ASC(MID$(A$(1),1,1))) + (256 * (ASC(MID$(A$(1),2,1)))) ' Number of records
- 120 A5 = (ASC(MID$(A$(5),1,1))) + (256 * (ASC(MID$(A$(5),2,1)))) - 1 ' Length of data record
- 125 '
- 130 ' Set field descriptors
- 135 '
- 140 C0 = 0
- 145 FOR I = 1 TO 32
- 150 Q$ = INPUT$(16,#1)
- 155 IF ASC(MID$(Q$,1,1)) = 13 THEN I = 32 : GOTO 195 ' End of fields
- 160 C1$(I) = ""
- 165 FOR K = 1 TO 10
- 170 IF ASC(MID$(Q$,K,1)) <> 0 THEN C1$(I) = C1$(I) + MID$(Q$,K,1)
- 175 NEXT K
- 180 C2$(I) = MID$(Q$,12,1)
- 185 C3(I) = VAL(MID$(Q$,13,1))
- 190 C0 = C0 + 1 ' Number of fields
- 195 NEXT I
- 200 Q$ = INPUT$( 1,#1) ' Skip
- 205 '
- 210 ' Read data record
- 215 '
- 220 Y$ = INPUT$( 1,#1) ' Delete flag
- 225 FOR I = 1 TO C0
- 230 Z$(I) = INPUT$(C3(I),#1) ' Read data field
- 235 NEXT I
- 240 '
- 245 ' List data record
- 250 '
- 255 CLS
- 260 FOR I = 1 TO C0
- 265 PRINT C1$(I); TAB(15); Z$(I) ' Print data field
- 270 NEXT I
- 275 LOCATE 22,1 : INPUT "enter <Return> to continue ";H$
- 280 GOTO 205
- 285 END
-